= gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-account-settings'), html: { class: 'fieldset-form', id: 'account-settings' } do |f|
  = form_errors(@application_setting)

  %fieldset
    .form-group
      = f.gitlab_ui_checkbox_component :gravatar_enabled, _('Gravatar enabled')

    .form-group
      = f.label :default_projects_limit, _('Default projects limit'), class: 'label-bold'
      = f.number_field :default_projects_limit, class: 'form-control gl-form-input', title: _('Maximum number of projects.'), data: { toggle: 'tooltip', container: 'body' }
    .form-group
      = f.label :max_attachment_size, _('Maximum attachment size (MiB)'), class: 'label-bold'
      = f.number_field :max_attachment_size, class: 'form-control gl-form-input', title: _('Maximum size of individual attachments in comments.'), data: { toggle: 'tooltip', container: 'body' }

    = render 'admin/application_settings/repository_size_limit_setting_registration_features_cta', form: f
    = render_if_exists 'admin/application_settings/repository_size_limit_setting', form: f

    .form-group
      = f.label :receive_max_input_size, _('Maximum push size (MiB)'), class: 'label-light'
      = f.number_field :receive_max_input_size, class: 'form-control gl-form-input', title: _('Maximum size limit for a single commit.'), data: { toggle: 'tooltip', container: 'body', testid: 'receive-max-input-size-field' }
    .form-group
      = f.label :session_expire_delay, s_('Settings|Session timeout duration'), class: 'label-light'
      = f.number_field :session_expire_delay, class: 'form-control gl-form-input', title: _('Maximum duration of a session. Restart GitLab to apply changes.'), data: { toggle: 'tooltip', container: 'body' }
      .form-text.gl-text-subtle= s_('Settings|Session duration, in minutes. Restart GitLab to apply changes.')
    .form-group
      = f.label :session_expire_from_init, s_('Settings|Session settings')
      = f.gitlab_ui_radio_component :session_expire_from_init, false, s_('Settings|Expire from time of last session activity')
      = f.gitlab_ui_radio_component :session_expire_from_init, true, s_('Settings|Expire from time of session creation')
    .form-group
      = f.label :remember_me_enabled, _('Remember me'), class: 'label-light'
      - remember_me_help_link = help_page_path('user/profile/_index.md', anchor: 'stay-signed-in-for-one-week')
      - remember_me_help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: remember_me_help_link }
      = f.gitlab_ui_checkbox_component :remember_me_enabled, _('Allow users to extend their session'), help_text: _("Users can select 'Remember me' on sign-in to keep their session active beyond the session duration. %{link_start}Learn more%{link_end}.").html_safe % { link_start: remember_me_help_link_start, link_end: '</a>'.html_safe }

    = render_if_exists 'admin/application_settings/git_two_factor_session_expiry', form: f
    = render_if_exists 'admin/application_settings/allow_top_level_group_owners_to_create_service_accounts', form: f

    .form-group
      = f.label :disable_feed_token, s_('AdminSettings|Feed token')
      = f.gitlab_ui_checkbox_component :disable_feed_token, s_('AdminSettings|Disable feed token')

    = render_if_exists 'admin/application_settings/disable_personal_access_tokens', form: f
    .form-group
      = f.label :personal_access_token_prefix, s_('AccessTokens|Access token prefix')
      = f.text_field :personal_access_token_prefix, placeholder: _('Maximum 20 characters'), class: 'form-control gl-form-input'
    - if Feature.enabled?(:custom_prefix_for_all_token_types, :instance)
      .form-group
        = f.label :instance_token_prefix, s_('AccessTokens|Instance token prefix')
        = f.text_field :instance_token_prefix, placeholder: _('Maximum 20 characters'), class: 'form-control gl-form-input'
    %h5= s_('AccessTokens|Access token expiration')
    .form-group
      = render 'admin/application_settings/require_access_token_expiry', form: f
      = render_if_exists 'admin/application_settings/service_accounts_pats_expiration_enforced', form: f
    = render_if_exists 'admin/application_settings/personal_access_token_expiration_policy', form: f

    = render 'admin/application_settings/project_and_group_access_tokens', form: f

    = render_if_exists 'admin/application_settings/ssh_key_expiration_policy', form: f

    .form-group
      = f.label :user_oauth_applications, _('User OAuth applications'), class: 'label-bold'
      = f.gitlab_ui_checkbox_component :user_oauth_applications, _('Allow users to register any application to use GitLab as an OAuth provider. This setting does not affect group-level OAuth applications.')
    .form-group
      = f.label :ropc_without_client_credentials, _('OAuth authorizations'), class: 'label-bold'
      = f.gitlab_ui_checkbox_component :ropc_without_client_credentials, _('Allow users to use resource owner password credentials flow without oauth client credentials')

    .form-group
      = f.label :user_default_external, _('External users'), class: 'label-bold'
      = f.gitlab_ui_checkbox_component :user_default_external, _('Make new users external by default')
      .gl-mt-3
        = _('Email exclusion pattern')
      = f.text_field :user_default_internal_regex, class: 'form-control gl-form-input gl-mt-2'
      .form-text.gl-text-subtle
        = _('Specify a regular expression for emails. New users with matching emails are not made external users.')
        #{link_to _('Learn more'), help_page_path('administration/external_users.md', anchor: 'make-new-users-external-by-default'), target: '_blank', rel: 'noopener noreferrer'}.
    - unless Gitlab.com?
      .form-group
        = f.label :deactivate_dormant_users, _('Dormant users'), class: 'label-bold'
        - dormant_users_help_link = help_page_path('administration/moderate_users.md', anchor: 'automatically-deactivate-dormant-users')
        - dormant_users_help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: dormant_users_help_link }
        = f.gitlab_ui_checkbox_component :deactivate_dormant_users, _('Deactivate dormant users after a period of inactivity'), help_text: _('Users can reactivate their account by signing in. %{link_start}Learn more%{link_end}.').html_safe % { link_start: dormant_users_help_link_start, link_end: '</a>'.html_safe }
        .form-group
          = f.label :deactivate_dormant_users_period, _('Days of inactivity before deactivation'), class: 'label-light'
          = f.number_field :deactivate_dormant_users_period, class: 'form-control gl-form-input', min: 90, required: true
          #application_setting_deactivate_dormant_users_period_error.form-text.gl-text-danger.gl-hidden
            = _('Please enter a value of 90 days or more')
          .form-text.gl-text-subtle
            = _('Must be 90 days or more. Applies only to users with sign-in history. Users with no sign-in history are automatically deactivated after 7 days.')

    .form-group
      = f.label :user_show_add_ssh_key_message, _('Prompt users to upload SSH keys'), class: 'label-bold'
      = f.gitlab_ui_checkbox_component :user_show_add_ssh_key_message, _("Inform users without uploaded SSH keys that they can't push over SSH until one is added")

    = render 'admin/application_settings/invitation_flow_enforcement', form: f
    = render 'admin/application_settings/user_restrictions', form: f
    = render_if_exists 'admin/application_settings/availability_on_namespace_setting', form: f
    -# This is added for Jihu edition which should not be deleted without notifying Jihu
    = render_if_exists 'admin/application_settings/password_expiration_setting', form: f
  = f.submit _('Save changes'), pajamas_button: true, data: { testid: 'save-changes-button' }
